<include file="Public/min-header"/>
<style type="text/css">
    .olist ul{float:left;background:#eee;border:1px solid #000066; position:absolute}
    .olist li{list-style:none;width:256px;height:30px;line-height:30px;border-bottom:1px dashed #ccc;margin-left:-30px;text-align: center;}

</style>
<div class="wrapper">
    <!-- Content Header (Page header) -->
   <include file="Public/breadcrumb"/>
    <section class="content">
    <!-- Main content -->
    <!--<div class="container-fluid">-->
    <div class="row">
      <div class="col-sm-12">
      <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-list"></i> 拜访任务信息</h3>
            </div>
            <div class="panel-body">
                <form action="" method="post" onsubmit="return checkUserUpdate(this);">
                    <table class="table table-bordered">
                    <tbody>
              <!--      <tr>
                        <td class="col-sm-2">会员昵称:</td>
                        <td ><img src="{$user.head_pic}" width="110">&nbsp;&nbsp;{$user.nick_name}</td>
                        <td></td>
                    </tr> -->
                    <tr>
                        <td>任务名称:</td>
                        <td><input type="text" class="form-control" name="visit_name" value="{$visit_data.visit_name}"></td>
                    </tr>
                   <tr>
                        <td>客户名称:</td>
                        <td><input type="text" class="form-control" name="custom_name" value="{$visit_data.custom_name}"></td>
                    </tr>

                    <tr>
                        <td>拜访时间:</td>
                        <td><input type="text" class="form-control" name="visit_time" value="{$visit_data.visit_time}"></td>
                    </tr>
                    <tr>
                        <td>拜访目的:</td>
                        <td>
                             <?php
            					if($visit_data['visit_purpose']==0){
            			     ?> 
            			     收集客户需求
            			     <?php
            					}elseif($visit_data['visit_purpose']==1){
            			     ?>
            			     了解客户需求
            			     <?php
            					}else{
            			     ?> 
            			     方案沟通
            			     <?php
            					}
            			     ?> 
                    </tr>

                    <tr>
                        <td>业务员:</td>
                        <td>
                            <input class="form-control" type="text" name="user_name" value="{$visit_data.user_name}">
                        </td>
                    </tr>
                    <tr>
                        <td>备注:</td>
                        <td>
                            <input type="text" class="form-control" name="remark" value="{$visit_data.remark}">
                        </td>
                    </tr>
                   
                   <tr>
                        <table  class="table table-bordered">
                            
                            <tr>
                                    <td>业务员:</td>
                                    <td>备注</td>
                                    <td>定位:</td>
                                    <td>定位图片</td>  
                                    <td>签到时间</td> 
                                    <td>签到信息</td>    
                                </tr>                            
                                <foreach name="detail_data" item="vo" key="k" >
                                <tr>
                                    <td style="width:100px">{$vo.user_name}</td>
                                    <td>{$vo.remark}</td>
                                    <td>{$vo.location_address}</td>
                                    <td style="width:500px">
                                        <?php
            					            if(strlen($vo['pic']) > 0){
            			                ?> <img src="{$vo.pic}" width="100px" height="100px">
            			                <?php
                        					}
                        			     ?> 
                        			     <?php
            					            if(strlen($vo['message_img1']) > 0){
            			                ?> <img src="{$vo.message_img1}" width="100px" height="100px">
            			                <?php
                        					}
                        			     ?> 
                        			     <?php
            					            if(strlen($vo['message_img2']) > 0){
            			                ?> <img src="{$vo.message_img2}" width="100px" height="100px">
            			                <?php
                        					}
                        			     ?> 
                                    <td style="width:160px">{$vo.addtime}</td> 
                                    <td>{$vo.type}</td>
                                </tr>
                                </foreach>
                        </table>
                    </tr>        
                    
                    <tr>
                        <td>
                            <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default pull-right" data-original-title="返回"><i class="fa fa-reply"></i></a>
                        </td>
                    </tr>
                    </tbody>
                </table>
                </form>

            </div>
        </div>
 	  </div> 
    </div>    <!-- /.content -->
   </section>
</div>
<script>

    function out_list(){
        var mytxt=$("#parent_name").val();
        $.ajax({
            type:'post',
            url:"{:U('User/out_list')}",
            dataType:'json',
            data:{key:mytxt},
            success:function(res){
                var olist=res.olist;
                var str='';
                for(var i=0;i<olist.length;i++){
                    str+='<li rel="'+olist[i]['mobile']+'">'+olist[i]['nickname']+olist[i]['mobile']+'</li>';
                }
                $('.olist ul').html('');
                $('.olist ul').html(str);
            }
        });
    }

    $(".olist").on("click","li",function(){
        var myrel=$(this).attr('rel');
        $("#parent_name").val(myrel);
        $('.olist ul').html('');
    });



    function checkUserUpdate(){
        var email = $('input[name="email"]').val();
        var mobile = $('input[name="mobile"]').val();
		
		var nickname = $('input[name="nickname"]').val();
        var company = $('input[name="company"]').val();
        var company_address = $('input[name="company_address"]').val();

        var error ='';
        // if(password != password2){
        //     error += "两次密码不一样\n";
        // }

        //if(!checkEmail(email)){
            //error += "邮箱地址有误\n";
       // }
        //if(!checkMobile(mobile)){
           // error += "手机号码填写有误\n";
       // }
        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        return true;

    }
</script>

</body>
</html>